#include "mainscence.h"
#include "ui_mainscence.h"
#include<QPushButton>
#include<QtDebug>
#include<QMediaPlayer>
MainScence::MainScence(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::MainScence)
{

    ui->setupUi(this);
    //开始按钮的大小
    ui->Start_Btn->setFixedSize(200,70);
    //开始按钮的位置
    ui->Start_Btn->move((GAME_WIDTH-ui->Start_Btn->width())*0.5,(GAME_HEIGHT-ui->Start_Btn->height())*0.5+300);
    //选择按钮的位置
    ui->Select_Btn->move((GAME_WIDTH-ui->Start_Btn->width())*0.5-20,(GAME_HEIGHT-ui->Start_Btn->height())*0.5+400);

    //商店按钮
    ui->shop_btn->move(700,250);
    //透明化商店
    ui->shop_btn->setFlat(true);
    ui->shop_btn->setAttribute(Qt::WA_TranslucentBackground);
    //初始化场景
    initSence();
    //游戏场景在主场景中的实现
    newplay=new Playscene;
    //选择场景在主场景中的实现
    choose=new  ChooseHero;
    //商店
    m_store=new  MyStore;
    //飞机位置
    m_hero_main.m_x=350;
    m_hero_main.m_y=700;
    //检测金币
    connect(newplay,&Playscene::gold_add,[=](){

        Gold_Sum->display(gold_sum);

        qDebug()<<"金币"<<gold_sum<< endl;
        gold_sum++;
        this->m_store->gold_num++;

    });

    //检测战机的购买
    //战机2的购买
    connect(m_store,&MyStore::BuyHero2,[=](){
        gold_sum-=HERO2_VALUE;
        Gold_Sum->display(gold_sum);
        choose->Hero2_isbuy=1;
        choose->Hero_Btn2->setIcon(QIcon(HERO_PATH2));

    });
    //战机三的购买
    connect(m_store,&MyStore::BuyHero3,[=](){
        gold_sum-=HERO3_VALUE;
        Gold_Sum->display(gold_sum);
        choose->Hero3_isbuy=1;
        choose->Hero_Btn3->setIcon(QIcon(HERO_PATH3));

    });
    //僚机一的购买
    connect(m_store,&MyStore::BuyWing1,[=](){
        gold_sum-=WING1_VALUE;
        Gold_Sum->display(gold_sum);
        choose->Wing1_isbuy=1;
        choose->Wing_Btn1->setIcon(QIcon(WING_PATH1));

    });
    //僚机2的购买
    connect(m_store,&MyStore::BuyWing2,[=](){
        gold_sum-=WING2_VALUE;
        Gold_Sum->display(gold_sum);
        choose->Wing2_isbuy=1;
        choose->Wing_Btn2->setIcon(QIcon(WING_PATH3));

    });
    //僚机3的购买
    connect(m_store,&MyStore::BuyWing3,[=](){
        gold_sum-=WING3_VALUE;
        Gold_Sum->display(gold_sum);
        choose->Wing3_isbuy=1;
        choose->Wing_Btn3->setIcon(QIcon(WING_PATH4));

    });
    //僚机4的购买
    connect(m_store,&MyStore::BuyWing4,[=](){
        gold_sum-=WING4_VALUE;
        Gold_Sum->display(gold_sum);
        choose->Wing4_isbuy=1;
        choose->Wing_Btn4->setIcon(QIcon(WING_PATH5));

    });
    //僚机5的购买
    connect(m_store,&MyStore::BuyWing5,[=](){
        gold_sum-=WING5_VALUE;
        Gold_Sum->display(gold_sum);
        choose->Wing5_isbuy=1;
        choose->Wing_Btn5->setIcon(QIcon(WING_PATH6));

    });
    //僚机6的购买
    connect(m_store,&MyStore::BuyWing6,[=](){
        gold_sum-=WING6_VALUE;
        Gold_Sum->display(gold_sum);
        choose->Wing6_isbuy=1;
        choose->Wing_Btn6->setIcon(QIcon(WING_PATH7));

    });

    //监听选择场景的返回信号
    connect(choose,&ChooseHero::returnmainscence,[=](){

        // 延时返回
        QTimer::singleShot(500,[=](){
            choose->hide();
            this->show();
        });
            m_hero_main.AddNum=1;
            is_big=0;
            recorder=0;
            recorder2=0;
    });
    //监听选择的战机
    connect(choose,&ChooseHero::SelectHero1,[=](){
        //主场景图标
        this->m_hero_main.m_Plane.load(HERO_PATH1);
        //游戏场景图标
        newplay->m_hero.m_Plane.load(HERO_PATH1);
        //子弹
        for(int i=0;i<BULL_NUM;i++)
        {
            //子弹图标
            newplay->m_hero.m_bullets1[i].m_Bullet.load(HERO1_BULLET);
            newplay->m_hero.m_bullets2[i].m_Bullet.load(HERO1_BULLET);
            newplay->m_hero.m_bullets3[i].m_Bullet.load(HERO1_BULLET);

            m_hero_main.m_bullets1[i].m_Bullet.load(HERO1_BULLET);
            m_hero_main.m_bullets2[i].m_Bullet.load(HERO1_BULLET);
            m_hero_main.m_bullets3[i].m_Bullet.load(HERO1_BULLET);
            //子弹速度
            newplay->m_hero.m_bullets1[i].m_Speed=BULLET1_SPEED;
            newplay->m_hero.m_bullets2[i].m_Speed=BULLET1_SPEED;
            newplay->m_hero.m_bullets3[i].m_Speed=BULLET1_SPEED;

            m_hero_main.m_bullets1[i].m_Speed=BULLET1_SPEED;
            m_hero_main.m_bullets2[i].m_Speed=BULLET1_SPEED;
            m_hero_main.m_bullets3[i].m_Speed=BULLET1_SPEED;
            //子弹伤害
            newplay->m_hero.m_Hurt=BULLET1_HURT;
        }
        //特殊子弹
        for(int i=0;i<BULL_NUM2;i++)
        {
            newplay->m_hero.m_special_bullets[i].m_Bullet.load(":/rec.image/Bullet05.png");
            m_hero_main.m_special_bullets[i].m_Bullet.load(":/rec.image/Bullet05.png");
        }
        //特殊子弹
        for(int i=0;i<BULL_NUM3;i++)
        {
            newplay->m_hero.m_special_bullets2[i].m_Bullet.load(":/rec.image/Bullet09.png");
            m_hero_main.m_special_bullets2[i].m_Bullet.load(":/rec.image/Bullet09.png");
        }
        //特殊子弹
        for(int i=0;i<BULL_NUM3;i++)
        {
            newplay->m_hero.m_special_bullets3[i].m_Bullet.load(":/rec.image/Bullet09.png");
            m_hero_main.m_special_bullets3[i].m_Bullet.load(":/rec.image/Bullet09.png");
        }
        //战机血量
        newplay->m_hero.m_Hero_Blood=HERO1_BLOOD;
        newplay->m_blood_num=HERO1_BLOOD;
        //战机蓝条
        newplay->m_hero.m_HERO_Blue=HERO1_BLUE;
        newplay->m_blue_num=HERO1_BLUE;


    }); newplay->m_hero.time=10;
    connect(choose,&ChooseHero::SelectHero2,[=](){
        this->m_hero_main.m_Plane.load(HERO_PATH2);
        newplay->m_hero.m_Plane.load(HERO_PATH2);
        for(int i=0;i<BULL_NUM;i++)
        {
            newplay->m_hero.m_bullets1[i].m_Bullet.load(HERO2_BULLET);
            newplay->m_hero.m_bullets2[i].m_Bullet.load(HERO2_BULLET);
            newplay->m_hero.m_bullets3[i].m_Bullet.load(HERO2_BULLET);

            m_hero_main.m_bullets1[i].m_Bullet.load(HERO2_BULLET);
            m_hero_main.m_bullets2[i].m_Bullet.load(HERO2_BULLET);
            m_hero_main.m_bullets3[i].m_Bullet.load(HERO2_BULLET);

            newplay->m_hero.m_bullets1[i].m_Speed=BULLET2_SPEED;
            newplay->m_hero.m_bullets2[i].m_Speed=BULLET2_SPEED;
            newplay->m_hero.m_bullets3[i].m_Speed=BULLET2_SPEED;

            m_hero_main.m_bullets1[i].m_Speed=BULLET2_SPEED;
            m_hero_main.m_bullets2[i].m_Speed=BULLET2_SPEED;
            m_hero_main.m_bullets3[i].m_Speed=BULLET2_SPEED;
            newplay->m_hero.time=10;
             m_hero_main.time=10;
            newplay->m_hero.m_Hurt=BULLET2_HURT;
        }
        //特殊子弹
        for(int i=0;i<BULL_NUM2;i++)
        {
            newplay->m_hero.m_special_bullets[i].m_Bullet.load(":/rec.image/Bullet06.png");
            m_hero_main.m_special_bullets[i].m_Bullet.load(":/rec.image/Bullet06.png");
        }
        //特殊子弹
        for(int i=0;i<BULL_NUM3;i++)
        {
            newplay->m_hero.m_special_bullets2[i].m_Bullet.load(":/rec.image/Bullet07.png");
            m_hero_main.m_special_bullets2[i].m_Bullet.load(":/rec.image/Bullet07.png");
        }
        //特殊子弹
        for(int i=0;i<BULL_NUM3;i++)
        {
            newplay->m_hero.m_special_bullets3[i].m_Bullet.load(":/rec.image/Bullet07.png");
            m_hero_main.m_special_bullets3[i].m_Bullet.load(":/rec.image/Bullet07.png");
        }
        newplay->m_hero.m_Hero_Blood=HERO2_BLOOD;
        newplay->m_blood_num=HERO2_BLOOD;
        newplay->m_hero.m_HERO_Blue=HERO2_BLUE;
        newplay->m_blue_num=HERO2_BLUE;



    });
    connect(choose,&ChooseHero::SelectHero3,[=](){

        this->m_hero_main.m_Plane.load(HERO_PATH3);
        newplay->m_hero.m_Plane.load(HERO_PATH3);
        for(int i=0;i<BULL_NUM;i++)
        {
            newplay->m_hero.m_bullets1[i].m_Bullet.load(HERO3_BULLET);
            newplay->m_hero.m_bullets2[i].m_Bullet.load(HERO3_BULLET);
            newplay->m_hero.m_bullets3[i].m_Bullet.load(HERO3_BULLET);

            m_hero_main.m_bullets1[i].m_Bullet.load(HERO3_BULLET);
            m_hero_main.m_bullets2[i].m_Bullet.load(HERO3_BULLET);
            m_hero_main.m_bullets3[i].m_Bullet.load(HERO3_BULLET);
            newplay->m_hero.m_bullets1[i].m_Speed=BULLET3_SPEED;
            newplay->m_hero.m_bullets2[i].m_Speed=BULLET3_SPEED;
            newplay->m_hero.m_bullets3[i].m_Speed=BULLET3_SPEED;

            m_hero_main.m_bullets1[i].m_Speed=BULLET3_SPEED;
            m_hero_main.m_bullets2[i].m_Speed=BULLET3_SPEED;
            m_hero_main.m_bullets3[i].m_Speed=BULLET3_SPEED;
            newplay->m_hero.time=20;
            m_hero_main.time=20;
            newplay->m_hero.m_Hurt=BULLET3_HURT;
        }
        //特殊子弹
        for(int i=0;i<BULL_NUM2;i++)
        {
            newplay->m_hero.m_special_bullets[i].m_Bullet.load(":/rec.image/Bullet04.png");
            m_hero_main.m_special_bullets[i].m_Bullet.load(":/rec.image/Bullet04.png");
        }
        //特殊子弹
        for(int i=0;i<BULL_NUM3;i++)
        {
            newplay->m_hero.m_special_bullets2[i].m_Bullet.load(":/rec.image/Bullet08.png");
            m_hero_main.m_special_bullets2[i].m_Bullet.load(":/rec.image/Bullet08.png");
        }
        //特殊子弹
        for(int i=0;i<BULL_NUM3;i++)
        {
            newplay->m_hero.m_special_bullets3[i].m_Bullet.load(":/rec.image/Bullet08.png");
            m_hero_main.m_special_bullets3[i].m_Bullet.load(":/rec.image/Bullet08.png");
        }
        newplay->m_hero.m_Hero_Blood=HERO3_BLOOD;
        newplay->m_blood_num=HERO3_BLOOD;
        newplay->m_hero.m_HERO_Blue=HERO2_BLUE;
        newplay->m_blue_num=HERO2_BLUE;



    });
    //监听游戏场景返回信号
    connect(newplay,&Playscene::returnmain,[=](){

        newplay->close();
        this->show();
        this->newplay->m_timer.stop();
        back_music->play();
        m_hero_main.AddNum=1;
        is_big=0;
        recorder=0;
        recorder2=0;
        qDebug()<<"返回"<<endl;

    });

    //监听选择的僚机1
    connect(choose,&ChooseHero::SelectWing1,[=](){
        newplay->m_Wing_left.is_on=1;
        newplay->m_Wing_right.is_on=1;
        newplay->m_Wing_left.m_Wing_Plane.load(WING_PATH1);
        newplay->m_Wing_right.m_Wing_Plane.load(WING_PATH1);
        newplay->Wing_Hurt=WING_BULLET01_HURT;
        //僚机子弹
        for(int i=0;i<WING_BULLET_NUM;i++)
        {
            newplay->m_Wing_left.m_bullets[i].m_Bullet.load(WING_BULLET01_PATH);
            newplay->m_Wing_right.m_bullets[i].m_Bullet.load(WING_BULLET01_PATH);
        }
    });
    //监听选择的僚机2
    connect(choose,&ChooseHero::SelectWing2,[=](){
        newplay->m_Wing_left.is_on=1;
        newplay->m_Wing_right.is_on=1;
        newplay->m_Wing_left.m_Wing_Plane.load(WING_PATH3);
        newplay->m_Wing_right.m_Wing_Plane.load(WING_PATH3);
        newplay->Wing_Hurt=WING_BULLET02_HURT;
        //僚机子弹
        for(int i=0;i<WING_BULLET_NUM;i++)
        {
            newplay->m_Wing_left.m_bullets[i].m_Bullet.load(WING_BULLET03_PATH);
            newplay->m_Wing_right.m_bullets[i].m_Bullet.load(WING_BULLET03_PATH);
        }
    });
    //监听选择的僚机3
    connect(choose,&ChooseHero::SelectWing3,[=](){
        newplay->m_Wing_left.is_on=1;
        newplay->m_Wing_right.is_on=1;
        newplay->m_Wing_left.m_Wing_Plane.load(WING_PATH4);
        newplay->m_Wing_right.m_Wing_Plane.load(WING_PATH4);
        newplay->Wing_Hurt=WING_BULLET03_HURT;
        //僚机子弹
        for(int i=0;i<WING_BULLET_NUM;i++)
        {
            newplay->m_Wing_left.m_bullets[i].m_Bullet.load(WING_BULLET04_PATH);
            newplay->m_Wing_right.m_bullets[i].m_Bullet.load(WING_BULLET04_PATH);
        }
    });
    //监听选择的僚机4
    connect(choose,&ChooseHero::SelectWing4,[=](){
        newplay->m_Wing_left.is_on=1;
        newplay->m_Wing_right.is_on=1;
        newplay->m_Wing_left.m_Wing_Plane.load(WING_PATH5);
        newplay->m_Wing_right.m_Wing_Plane.load(WING_PATH5);
        newplay->Wing_Hurt=WING_BULLET04_HURT;
        //僚机子弹
        for(int i=0;i<WING_BULLET_NUM;i++)
        {
            newplay->m_Wing_left.m_bullets[i].m_Bullet.load(WING_BULLET05_PATH);
            newplay->m_Wing_right.m_bullets[i].m_Bullet.load(WING_BULLET05_PATH);
        }
    });
    //监听选择的僚机5
    connect(choose,&ChooseHero::SelectWing5,[=](){
        newplay->m_Wing_left.is_on=1;
        newplay->m_Wing_right.is_on=1;
        newplay->m_Wing_left.m_Wing_Plane.load(WING_PATH6);
        newplay->m_Wing_right.m_Wing_Plane.load(WING_PATH6);
        newplay->Wing_Hurt=WING_BULLET05_HURT;
        //僚机子弹
        for(int i=0;i<WING_BULLET_NUM;i++)
        {
            newplay->m_Wing_left.m_bullets[i].m_Bullet.load(WING_BULLET06_PATH);
            newplay->m_Wing_right.m_bullets[i].m_Bullet.load(WING_BULLET06_PATH);
        }
    });
    //监听选择的僚机6
    connect(choose,&ChooseHero::SelectWing6,[=](){
        newplay->m_Wing_left.is_on=1;
        newplay->m_Wing_right.is_on=1;
        newplay->m_Wing_left.m_Wing_Plane.load(WING_PATH7);
        newplay->m_Wing_right.m_Wing_Plane.load(WING_PATH7);
        newplay->Wing_Hurt=WING_BULLET06_HURT;
        //僚机子弹
        for(int i=0;i<WING_BULLET_NUM;i++)
        {
            newplay->m_Wing_left.m_bullets[i].m_Bullet.load(WING_BULLET07_PATH);
            newplay->m_Wing_right.m_bullets[i].m_Bullet.load(WING_BULLET07_PATH);
        }
    });


    //背景音乐
    back_music=new  QMediaPlayer(this);
    back_music->setMedia(QUrl(MUSIC_BACK01));
    back_music->setVolume(80);
    playlist=new QMediaPlaylist(this);
    playlist->addMedia(QUrl(MUSIC_BACK01));
    back_music->setPlaylist(playlist);
    back_music->play();
    playlist->setPlaybackMode(QMediaPlaylist::CurrentItemInLoop);


    //按钮音效
    btn_music=new  QSound(MUSIC_BTN);




}

MainScence::~MainScence()
{
    delete ui;
}
//初始化主场景
void MainScence::initSence()
{

    m_hero_main.AddNum=1;
    //定时器设置
    m_timer.setInterval(GAME_RATE);
    //设置窗口固定尺寸
    setFixedSize(GAME_WIDTH,GAME_HEIGHT);
    //设置标题
    setWindowTitle(GAME_TITLE);
    //设置标题图片
    setWindowIcon(QIcon(":/rec.image/Icon.png"));
    //设置背景
    update();
    //点击开始按钮，跳转游戏场景
    connect(ui->Start_Btn,&QPushButton::clicked,[=](){
        // 延时进入
        QTimer::singleShot(500,[=](){
            this->hide();
            qDebug()<<"1000";
            newplay->show();
        });

        this->newplay->m_timer.start();
        back_music->stop();
        newplay->back_music->play();
        btn_music->play();


    });
    //点击选择按钮，跳转选择飞机场景
    connect(ui->Select_Btn,&QPushButton::clicked,[=](){
        // 延时进入
        QTimer::singleShot(500,[=](){
       this->hide();
        qDebug()<<"1000";
        choose->show();
        });
        btn_music->play();

    });

    //点击商店按钮，跳转商店界面
    connect(ui->shop_btn,&QPushButton::clicked,[=](){
        // 延时进入
        QTimer::singleShot(500,[=](){
            m_store->show();
        });
        btn_music->play();
    });

    //金币记录

    Gold_Sum=new QLCDNumber;
    Gold_Sum->setParent(this);
     //设置字体
    Gold_Sum->setDecMode();

    Gold_Sum->setFrameStyle(0);

    //位置
    Gold_Sum->move(30,0);
    //大小
    Gold_Sum->setFixedSize(QSize(100,70));

    //文字
    QLabel*lab_gold=new QLabel(this);
    QPixmap pix_gold;
    pix_gold.load(GOLD_PATH);
    lab_gold->setFixedSize(50,50);
    lab_gold->setPixmap(pix_gold);
    lab_gold->show();
    lab_gold->move(10,10);
    Gold_Sum->display(gold_sum);





    //播放飞机
    playGame();


}
//绘制主场景背景
void MainScence::paintEvent(QPaintEvent *event)
{
    QPixmap pix;
    pix.load(":/rec.image/Mainscene_Back01.png");
    QPainter painter(this);
    painter.drawPixmap(0,0,pix);
    //绘制飞机
    painter.drawPixmap(350,700,m_hero_main.m_Plane);


    for(int i=0;i<BULL_NUM;i++)
    {
        //如果非空闲，开始绘制
        if(m_hero_main.AddNum==1)
        {
            if(m_hero_main.m_bullets1[i].m_Free==0)
            {
               painter.drawPixmap(m_hero_main.m_bullets1[i].m_x,m_hero_main.m_bullets1[i].m_y,m_hero_main.m_bullets1[i].m_Bullet);
            }
        }
        else if(m_hero_main.AddNum==2)
        {
            if(m_hero_main.m_bullets1[i].m_Free==0)
            {
                painter.drawPixmap(m_hero_main.m_bullets1[i].m_x,m_hero_main.m_bullets1[i].m_y,m_hero_main.m_bullets1[i].m_Bullet);
            }

            if(m_hero_main.m_bullets3[i].m_Free==0)
            {
                painter.drawPixmap(m_hero_main.m_bullets3[i].m_x,m_hero_main.m_bullets3[i].m_y,m_hero_main.m_bullets3[i].m_Bullet);
            }
        }
        else if(m_hero_main.AddNum==3)
        {
            if(m_hero_main.m_bullets1[i].m_Free==0)
            {
                painter.drawPixmap(m_hero_main.m_bullets1[i].m_x,m_hero_main.m_bullets1[i].m_y,m_hero_main.m_bullets1[i].m_Bullet);
            }

            if(m_hero_main.m_bullets2[i].m_Free==0)
            {
                painter.drawPixmap(m_hero_main.m_bullets2[i].m_x,m_hero_main.m_bullets2[i].m_y,m_hero_main.m_bullets2[i].m_Bullet);
            }

            if(m_hero_main.m_bullets3[i].m_Free==0)
            {
                painter.drawPixmap(m_hero_main.m_bullets3[i].m_x,m_hero_main.m_bullets3[i].m_y,m_hero_main.m_bullets3[i].m_Bullet);
            }
        }

    }

    //绘制特殊子弹

    for(int i=0;i<BULL_NUM2;i++)
    {
            if(m_hero_main.m_special_bullets [i].m_Free==0)
            {
                painter.drawPixmap(m_hero_main.m_special_bullets[i].m_x,m_hero_main.m_special_bullets[i].m_y,m_hero_main.m_special_bullets[i].m_Bullet);
            }

    }
    //绘制第二种特殊子弹
    for(int i=0;i<BULL_NUM3;i++)
    {
            if(m_hero_main.m_special_bullets2[i].m_Free==0)
            {
                painter.drawPixmap(m_hero_main.m_special_bullets2[i].m_x,m_hero_main.m_special_bullets2[i].m_y,m_hero_main.m_special_bullets2[i].m_Bullet);
            }
    }
    //绘制第三种特殊子弹
    for(int i=0;i<BULL_NUM3;i++)
    {
        if(m_hero_main.m_special_bullets3[i].m_Free==0)
        {
            painter.drawPixmap(m_hero_main.m_special_bullets3[i].m_x,m_hero_main.m_special_bullets3[i].m_y,m_hero_main.m_special_bullets3[i].m_Bullet);
        }
    }

}

void MainScence::updatePosition()
{
    //发射子弹
    m_hero_main.shoot();

    recorder++;
    recorder2++;
    if(recorder>=200)
    {
        m_hero_main.AddNum++;
        if(m_hero_main.AddNum>=3)
        {
            m_hero_main.AddNum=3;
        }
        recorder=0;
    }


    if(recorder2>=600)
    {
        is_big=1;
        QTimer::singleShot(5000,[=](){
            is_big=0;
            m_hero_main.AddNum=1;
            recorder2=0;
            recorder=0;
        });

    }

    //计算所有非空闲子弹当前坐标
    for(int i=0;i<BULL_NUM;i++)
    {
        //如果非空闲，计算发射位置
        if(m_hero_main.AddNum==1)
        {
            if(m_hero_main.m_bullets1[i].m_Free==0)
            {
                m_hero_main.m_bullets1[i].updatePosition();
            }
        }
        else if(m_hero_main.AddNum==2)
        {
            if(m_hero_main.m_bullets1[i].m_Free==0)
            {
                m_hero_main.m_bullets1[i].updatePosition();
            }

            if(m_hero_main.m_bullets3[i].m_Free==0)
            {
                m_hero_main.m_bullets3[i].updatePosition();
            }
        }
        else if(m_hero_main.AddNum==3)
        {
            if(m_hero_main.m_bullets1[i].m_Free==0)
            {
                m_hero_main.m_bullets1[i].updatePosition();
            }


            if(m_hero_main.m_bullets2[i].m_Free==0)
            {
                m_hero_main.m_bullets2[i].updatePosition();
            }

            if(m_hero_main.m_bullets3[i].m_Free==0)
            {
                m_hero_main.m_bullets3[i].updatePosition();
            }
        }
    }

    if(is_big)
    {
        m_hero_main.shoot2();
        m_hero_main.shoot3();
        m_hero_main.shoot4();
    }

    //特殊子弹的发射
    for(int i=0;i<BULL_NUM2;i++)
    {

        if(m_hero_main.m_special_bullets[i].m_Free==0)
        {
            m_hero_main.m_special_bullets[i].updatePosition2();
        }

    }

    //特殊子弹二
    for(int i=0;i<BULL_NUM3;i++)
    {

        if(m_hero_main.m_special_bullets2[i].m_Free==0)
        {
            m_hero_main.m_special_bullets2[i].updatePosition3();
        }

    }
    //特殊子弹三
    for(int i=0;i<BULL_NUM3;i++)
    {
        if(m_hero_main.m_special_bullets3[i].m_Free==0)
        {
            m_hero_main.m_special_bullets3[i].updatePosition4();
        }
    }




}

void MainScence::playGame()
{
    m_timer.start();

    //监听定时器发出的信号
    connect(&m_timer,&QTimer::timeout,[=](){
        //绘制

        updatePosition();

        update();

    });
}

